#include <iostream>
#include <cmath>
using namespace std;
int main() {
    int n, k =0, l =0, sum =0;
    cin >> n;
    for (int i = pow(10,n-1); i < pow(10,n); i++) {
        k=i;
        for (int j =1; j <= n; j++) {
            l = k % 10;
            k = k / 10;
            sum += pow(l,n);
        }
        if (sum == i) {
            cout << i << endl;
        }
        sum =0;
    }
    return 0;
}
